package com.yuanfengPlus.basicInfoManage.storeinfo.conorller;


import com.yuanfengPlus.basicInfoManage.storeinfo.model.StoreDto;
import com.yuanfengPlus.basicInfoManage.storeinfo.model.Storeinfo;
import com.yuanfengPlus.basicInfoManage.storeinfo.service.impl.StoreinfoServiceImpl;
import com.yuanfengPlus.utils.PageResult;
import com.yuanfengPlus.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
@CrossOrigin
@Api(tags = "门店信息管理")
public class StoreinfoCon {
    @Autowired
    StoreinfoServiceImpl ssi;

    @PostMapping("/selectStoreAll")
    @ApiOperation(value = "查询全部门店")
    public Result<PageResult> selectStoreAll(@RequestBody StoreDto storeDto){
        return ssi.selectStoreAll(storeDto);
    }

    @PostMapping("/selectStore")
    @ApiOperation(value = "查询单个门店")
    public Result<Storeinfo> selectStore(String id){
        return ssi.selectStore(id);
    }

    @PostMapping("/addStore")
    @ApiOperation(value = "添加门店")
    public Result<String> addStore(@RequestBody Storeinfo storeinfo){
        return ssi.addStore(storeinfo);
    }

    @PostMapping("/updateStore")
    @ApiOperation(value = "修改门店")
    public Result<String> updateStore(@RequestBody Storeinfo storeinfo){
        return ssi.updateStore(storeinfo);
    }
}
